package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.impl.FileUploadServiceImpl;
import com.atguigu.spzx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * FileUploadController
 * </p>
 *
 * @author flyduck
 * @since 2023/10/27
 */
@Api(tags = "文件上传相关接口")
@RestController
@RequestMapping("/admin/system")
public class FileUploadController {

    @Autowired
    private FileUploadServiceImpl fileUploadService;

    @ApiOperation(("文件上传"))
    @PostMapping("/fileUpload")
    public Result fileUpload(@RequestParam("file") MultipartFile file){
        String url = fileUploadService.fileUpload(file);
        return Result.ok(url);
    }
}
